package com.open.basic.config;

import com.open.basic.util.AssertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import javax.annotation.PostConstruct;


/**
 * @author: zm
 * @Date: 2025/9/20 22:50
 * @Version: V1.0
 * @description: | 必要配置检查
 */

@Slf4j
@Component
@Order(Integer.MIN_VALUE)
public class ConfigCheck {

    @Value("${spring.application.name}")
    private String appName;

    @Value("${app.file.path}")
    private String path;

    @PostConstruct
    public void init() {
        AssertUtil.assertTrue(StringUtils.hasText(appName), "appName is empty");
        AssertUtil.assertTrue(StringUtils.hasText(path), "path is empty");
    }
}
